package com.hjj.appdata;

import com.hjj.beans.Stu;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class MyApp2 {
    public static void main(String[] args) {
        Stu stu;

        String path = "F:\\IO\\stu3.data";

        try {
            FileInputStream fileInputStream = new FileInputStream(path);
            ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);

            // 反序列化
            stu = (Stu) objectInputStream.readObject();

            System.out.println(stu);

            objectInputStream.close();
            fileInputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
